<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
	String basePath = request.getContextPath();
    String msg = "";
    if (request.getAttribute("msg") != null) {
        msg = (String) request.getAttribute("msg");
    }
%>
<html>
<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>注册界面</title>
</head>
<body>
	<center>
		<h1>用户注册</h1>
        <h3 id="MSG"><font color="#dc143c"><%= msg%></font></h3>
		<form action="<%=basePath%>/RegistServlet" method="post">
			<table width="400px" cellspacing="0px" cellpadding="0px" border="1px">
				<tr>
					<td>用户名</td>
					<td><input type="text" name="username" pattern="[0-9a-zA-Z_]{3,12}"
							   required="required" placeholder="用户名为3-12位字母数字或下划线组合" ></td>
				</tr>
				<tr>
					<td>密&nbsp;码</td>
					<td><input type="password" name="password" pattern="[0-9]{6,12}"
							   required="required" placeholder="密码长度为6-12位的纯数字"  id="password"></td>
				</tr>
				<tr>
					<td>确认密码</td>
					<td><input type="password" name="checkPWD" placeholder="密码长度为6-12位的纯数字" id="checkPWD"></td>
				</tr>
				<tr>
					<td>手机号码</td>
					<td><input type="text" name="phone" pattern="1[3578]\d{9}"
							   required="required" placeholder="请输入正确的手机号码格式" ></td>
				</tr>
				<tr>
					<td>邮箱</td>
					<td><input type="email" name="email" placeholder="请输入正确邮箱格式" required="required"></td>
				</tr>
				<tr>
					<td colspan="2" style="text-align:center">
						<input type="submit" value="注册" onclick="return judge();">
						<input type="reset" value="重置">
					</td>
				</tr>
			</table>
		</form>
	</center>
	<script type="text/javascript">
        function judge(){  // 防止两次密码不同
            var pas1 = document.getElementById("password").value;
            var pas2 = document.getElementById("checkPWD").value;
            if(pas3 != pas4){
                alert("两次输入的密码不一致！");
                return false;
            }
        }
	</script>
</body>
</html>